<?php
ob_start();
session_cache_expire(999999999);
if (!isset($_SESSION)) {
    session_start();
}
?>
<html><head>
	<title>Price Checking</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link href="css/default.css" rel="stylesheet" type="text/css">
</head>
<?php 
include "connection_open.php";

if(isset($_REQUEST['aid'])){
	$id=$_REQUEST['aid'];
	$pw=md5($_REQUEST['apw']);
	$result=mysql_query("SELECT * from admin a WHERE a.username='$id' AND a.password='$pw'");
	if(mysql_num_rows($result)>0){
		$r=mysql_fetch_array($result);
		$mang=array($r['id'],$r['username'],$r['role']);
		$_SESSION['accountshopping']=$mang;
		}else{		
			header("Location: index.php");
			
		}
		
	}else{
		echo '<script>
		alert("Dang nhap khong thanh cong !!! Ban vui long kiem tra lai tai khoan hay mat khau !!!");
		</script>';
		header("Location: login.php");
	}
	
include "connection_close.php";
ob_flush();
?>
</html>